#include <stdio.h>
#include <string.h>

char* boxes[16] = {0};

void put(char* num) {
  char *pnum = num;

  while(*pnum !=0 && *pnum != ','){
    pnum++;
  }

  int i = *(pnum - 1) - '0';

  while (boxes[i] != 0) {
    i = (++i) % 10;
  }

  boxes[i] = num;
}

int main() {
  char nums[1024];
  int n;
  scanf("%d", &n);
  scanf("%s", nums);

  char* pnum = nums;
  put(pnum);
  pnum++;
  while (*pnum != 0) {
    if (*pnum == ',') {
      put(pnum + 1);
    }
    pnum++;
  }

  for (int i = 0; i < 10; i++) {
    char* p = boxes[i];
    if (p != 0) {
      while (*p != 0 && *p != ',') {
        putchar(*(p++));
      }
    } else {
      putchar('0');
    }

    if (i != 9) {
      putchar(',');
    }
  }
}